package com.cn.onetrip.adapter;

import java.util.Vector;

import android.content.Context;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.cn.onetrip.activity.R;

public class MoreItemAdapter extends BaseAdapter {

	public Vector<Integer> mModels = new Vector<Integer>();
	private LayoutInflater mInflater;
	private Context mContext;
	private ListView mListView;
	private Handler mhandler;

	public MoreItemAdapter(Context context, ListView listView, Handler handler) {
		mInflater = LayoutInflater.from(context);
		mContext = context;
		mListView = listView;
		mhandler = handler;
	}

	public void addTitleText(Integer srcTextInt) {
		mModels.add(srcTextInt);
	}

	public void clean() {
		mModels.clear();
	}

	@Override
	public int getCount() {
		return mModels.size();
	}

	@Override
	public Object getItem(int position) {
		if (position >= getCount()) {
			return null;
		}
		return mModels.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		int srcTextInt = mModels.get(position);
		convertView = mInflater.inflate(R.layout.more_list_items, null);
		convertView.setTag(position);
		TextView titleText = (TextView) convertView
				.findViewById(R.id.ItemTitleText);
		titleText.setText(srcTextInt);
		return convertView;
	}

}
